package com.manage.pojo.entity.ai;


import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 消息对象 cm_ai_messages
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Data
@TableName("cm_ai_message")
public class CmAiMessages
{
    private static final long serialVersionUID = 1L;

    /** id */
    @TableId
    private Long id;

    /** 外部唯一id */
    private String publicId;

    /** 会话id */
    private Long sessionId;

    /** 消息顺序（会话内时序编号） */
    private Long sequence;

    /** 发送角色 */
    private String role;

    /** 消息正文 */
    private String content;

    /** 提问消耗Token */
    private Long tokensIn;

    /** 回复消耗Token */
    private Long tokensOut;

    /** 扩展信息 */
    private String metaInfo;

    /**创建时间*/
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;


    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("publicId", getPublicId())
            .append("sessionId", getSessionId())
            .append("sequence", getSequence())
            .append("role", getRole())
            .append("content", getContent())
            .append("tokensIn", getTokensIn())
            .append("tokensOut", getTokensOut())
            .append("metaInfo", getMetaInfo())
            .append("createTime", getCreateTime())
            .toString();
    }
}
